package com.bsj.travel.system.config;

import com.bsj.travel.system.authorization.interceptor.AdminControlInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/***
 * @description WebConfig
 * @author LiJiaXin
 * @version 1.0.0
 * @time 2024/1/11 14:05
 **/
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private AdminControlInterceptor adminControlInterceptor;

    /**
     * 添加拦截器
     *
     * @param registry
     * @return void
     * @author ljx
     * @time 2024/1/11 14:06
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 自定义拦截器，添加拦截路径和排除拦截路径
        registry.addInterceptor(adminControlInterceptor).addPathPatterns("/**");
    }

}
